]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspace: Implement windowCenter using bounding box
authorJonas Dreßler <verdre@v0yd.nl>
Sun, 31 May 2020 20:48:28 +0000 (22:48 +0200)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Thu, 4 Jun 2020 17:40:09 +0000 (17:40 +0000)
This isn't quite the same as the allocation, but it's what the workspace
actually wants to use given that we use the bounding box of the
WindowClone for all the layout calculation.

So instead of calculating the windowCenter in the WindowClone, make use
of the bounding-box property of the layout manager and return the center
point of that.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1297

js/ui/workspace.js

index 03b4edb3dcd2c9820161889a67856c81e3f24d3a..d58114dfce6c63f2f2e41b17c54fd1450cb1ac6c 100644 (file)
@@ -222,8 +222,6 @@ var WindowClone = GObject.registerClass({
         this.x = this.boundingBox.x;
         this.y = this.boundingBox.y;
 
-        this._computeWindowCenter();
-
         let clickAction = new Clutter.ClickAction();
         clickAction.connect('clicked', this._onClicked.bind(this));
         clickAction.connect('long-press', this._onLongPress.bind(this));
@@ -328,12 +326,9 @@ var WindowClone = GObject.registerClass({
     }
 
     get windowCenter() {
-        return this._windowCenter;
-    }
+        const box = this.layout_manager.bounding_box;
 
-    _computeWindowCenter() {
-        let box = this.realWindow.get_allocation_box();
-        this._windowCenter = new Graphene.Point({
+        return new Graphene.Point({
             x: box.get_x() + box.get_width() / 2,
             y: box.get_y() + box.get_height() / 2,
         });